﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Graph
{
    public class BinaryTree<T>
    {
        #region Properties

        private BinaryTreeNode<T> root; //the root of the tree

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a binary tree with no root - set the root via the Root accessor
        /// </summary>
        
        public BinaryTree()
        {
            root = null;
        }

        /// <summary>
        /// Initializes a binary tree
        /// </summary>
        /// <param name="root">The root of the tree</param>
        
        public BinaryTree(BinaryTreeNode<T> root)
        {
            this.root = root;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Clears the tree of all nodes
        /// </summary>

        public void Clear()
        {
            root = null;
        }

        #endregion

        #region Accessors

        /// <summary>
        /// The root of the tree
        /// </summary>
        
        public BinaryTreeNode<T> Root
        {
            get
            {
                return root;
            }
            set
            {
                root = value;
            }
        }

        #endregion
    }
}
